package com.usf.jprovider.schema.provider.pointer.dynamic;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;

import com.usf.jprovider.exception.FieldNotFoundException;
import com.usf.jprovider.object.JObjectNode;
import com.usf.jprovider.schema.provider.pointer.AbstractPointer;

@XmlSeeAlso({LocalPointer.class, 
			 GlobalPointer.class})
public abstract class AbstractDynamicPointer extends AbstractPointer {

	@XmlAttribute protected String field;
	
	protected AbstractDynamicPointer() {
		super();
		field = "";
	}
	public String getField() {
		return field;
	}
	
	public AbstractDynamicPointer(String field) {
		this.field = field;
	}
	@Override
	public final boolean isDependent(JObjectNode node) throws FieldNotFoundException {
		return pointedNode(node).isChanged();
	}
	
	public abstract JObjectNode pointedNode(JObjectNode node) throws FieldNotFoundException;
}
